﻿// Copyright (c) ZhangPeihang. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using LaserMark.DataAccess.Models;
using LaserMark.DataAccess.Service;

namespace LaserMark.DataAccess.Service;
public class ComprehensiveService : IComprehensiveService
{
    private IDBManager DbManager { get; set; }

    public ComprehensiveService(IDBManager dbManager)
    {
        DbManager = dbManager;
    }

    public async Task<ComprehensiveSetting> Get()
    {
        using (var db = DbManager.Create())
        {
            return await db.SingleAsync<ComprehensiveSetting>("where Id = 1");
        }
    }

    public async Task<bool> Update(ComprehensiveSetting comprehensive)
    {
        using (var db = DbManager.Create())
        {
            return (await db.UpdateAsync(comprehensive)) > 0;
        }
    }
}
